﻿Imports System.Windows.Forms

Module modShowSelectForm
    Public Enum SelectType
        Plasma
        FTT
        FTT_PQC
        FTG
        FinalTest
        OK_NG
        Wafer
        WaferCheck
        ZONE
        AnalysisTreat
    End Enum

    Public Enum SelectResult
        P_C1 = DialogResult.Abort
        P_C2 = DialogResult.Retry
        PlazmaWB = DialogResult.Yes
        PlazmaMD = DialogResult.No
        Test0 = DialogResult.Abort
        Test1 = DialogResult.Ignore
        Test2 = DialogResult.Retry
        Test3 = DialogResult.Cancel
        Check1 = DialogResult.OK
        Check2 = DialogResult.Yes
        CheckFinal = DialogResult.Cancel
        NormalComplete = DialogResult.OK
        TestComplete = DialogResult.Ignore
        IN5 = DialogResult.OK
        IN6 = DialogResult.Cancel
        IN8 = DialogResult.Abort
        IN12 = DialogResult.Retry
        WaferCorss = DialogResult.Retry
        Wafer4P = DialogResult.Abort
        WaferNone = DialogResult.Ignore
        NormalFlow = DialogResult.OK
        AnalysisResult = DialogResult.Ignore
    End Enum

    ''' <summary>
    ''' 工程を選択
    ''' </summary>
    ''' <param name="DialogType">工程種類</param>
    ''' <returns>選択結果</returns>
    ''' <remarks></remarks>
    Public Function SelectDialog(ByVal DialogType As SelectType, ByRef htMsgMst As Hashtable) As SelectResult
        Dim frmSelect As New ShowSelectForm

        With frmSelect
            Select Case DialogType
                Case SelectType.Plasma
                    .lblText.Text = "プラズマ工程を選択して下さい。"
                    .Button1.Visible = True
                    .Button1.Text = "P/C1"
                    .Button1.DialogResult = SelectResult.P_C1
                    .Button2.Visible = True
                    .Button2.Text = "P/C2"
                    .Button2.DialogResult = SelectResult.P_C2
                    .Button3.Visible = True
                    .Button3.Text = "W/B前"
                    .Button3.DialogResult = SelectResult.PlazmaWB
                    .Button4.Visible = True
                    .Button4.Text = "モールド前"
                    .Button4.DialogResult = SelectResult.PlazmaMD
                Case (SelectType.FTT)
                    .lblText.Text = "テスト工程を選択して下さい。"
                    .Button1.Text = "0DC+FT"
                    .Button1.DialogResult = SelectResult.Test0
                    .Button1.Visible = True
                    .Button1.Enabled = False
                    .Button2.Text = "1DC+FT"
                    .Button2.DialogResult = SelectResult.Test1
                    .Button2.Visible = True
                    .Button3.Text = "2DC+FT"
                    .Button3.DialogResult = SelectResult.Test2
                    .Button3.Visible = True
                    .Button4.Text = "3DC+FT"
                    .Button4.DialogResult = SelectResult.Test3
                    .Button4.Visible = True
                Case (SelectType.FTT_PQC)
                    .lblText.Text = "テスト工程を選択して下さい。"
                    .Button1.Text = "0DC+FT"
                    .Button1.DialogResult = SelectResult.Test0
                    .Button1.Visible = True
                    .Button2.Text = "1DC+FT"
                    .Button2.DialogResult = SelectResult.Test1
                    .Button2.Visible = True
                    .Button3.Text = "2DC+FT"
                    .Button3.DialogResult = SelectResult.Test2
                    .Button3.Visible = True
                    .Button4.Text = "3DC+FT"
                    .Button4.DialogResult = SelectResult.Test3
                    .Button4.Visible = True
                Case SelectType.FTG
                    .lblText.Text = "検査項目を選択して下さい。"
                    .Button1.Text = "外観検査1"
                    .Button1.DialogResult = SelectResult.Check1
                    .Button1.Visible = True
                    .Button2.Text = "外観検査2"
                    .Button2.DialogResult = SelectResult.Check2
                    .Button2.Visible = True
                    .Button3.Visible = False
                    .Button4.Text = "最終検査"
                    .Button4.DialogResult = SelectResult.CheckFinal
                    .Button4.Visible = True
                Case SelectType.FinalTest
                    .lblText.Text = "完成タイプを選択して下さい。"
                    .Button1.Visible = False
                    .Button2.Text = "計上完成"
                    .Button2.DialogResult = SelectResult.NormalComplete
                    .Button2.Visible = True
                    .Button3.Text = "FinalTest完成"
                    .Button3.DialogResult = SelectResult.TestComplete
                    .Button3.Visible = True
                    .Button4.Visible = False
                Case SelectType.OK_NG
                    .lblText.Text = htMsgMst("MSG00072")
                    .Button1.Text = OK
                    .Button1.DialogResult = DialogResult.OK
                    .Button1.Visible = True
                    .Button2.Text = NG
                    .Button2.DialogResult = DialogResult.No
                    .Button2.Visible = True
                    .Button3.Visible = False
                    .Button4.Text = htMsgMst("MSG00075")
                    .Button4.DialogResult = DialogResult.Cancel
                    .Button4.Visible = True
                Case SelectType.Wafer
                    .lblText.Text = htMsgMst("MSG00073")
                    .Button1.Text = "5in - 127mm"
                    .Button1.DialogResult = SelectResult.IN5
                    .Button1.Visible = True
                    .Button2.Text = "6in - 152mm"
                    .Button2.DialogResult = SelectResult.IN6
                    .Button2.Visible = True
                    .Button3.Text = "8in - 203mm"
                    .Button3.DialogResult = SelectResult.IN8
                    .Button3.Visible = True
                    .Button4.Text = "12in - 300mm"
                    .Button4.DialogResult = SelectResult.IN12
                    .Button4.Visible = True
                Case SelectType.WaferCheck
                    .lblText.Text = htMsgMst("MSG00074")
                    .Button1.Text = htMsgMst("MSG00076")
                    .Button1.DialogResult = SelectResult.WaferCorss
                    .Button1.Visible = True
                    .Button2.Text = htMsgMst("MSG00077")
                    .Button2.DialogResult = SelectResult.Wafer4P
                    .Button2.Visible = True
                    .Button3.Visible = False
                    .Button4.Text = htMsgMst("MSG00078")
                    .Button4.DialogResult = SelectResult.WaferNone
                    .Button4.Visible = True
                Case SelectType.ZONE
                    .lblText.Text = htMsgMst("MSG00106")
                    .Button1.Text = htMsgMst("MSG00104")
                    .Button1.DialogResult = DialogResult.OK
                    .Button1.Visible = True
                    .Button2.Text = htMsgMst("MSG00105")
                    .Button2.DialogResult = DialogResult.No
                    .Button2.Visible = True
                    .Button3.Visible = False
                    .Button4.Text = htMsgMst("MSG00075")
                    .Button4.DialogResult = DialogResult.Cancel
                    .Button4.Visible = True
                Case SelectType.AnalysisTreat
                    .lblText.Text = htMsgMst("MSG00072")
                    .Button1.Text = htMsgMst("MSG00108")
                    .Button1.DialogResult = SelectResult.NormalFlow
                    .Button1.Visible = True
                    .Button2.Text = htMsgMst("MSG00109")
                    .Button2.DialogResult = SelectResult.AnalysisResult
                    .Button2.Visible = True
                    .Button3.Visible = False
                    .Button4.Text = htMsgMst("MSG00075")
                    .Button4.DialogResult = DialogResult.Cancel
                    .Button4.Visible = True
            End Select
            .Text = htMsgMst("MSG00086")
            ' >> del 安部 2018/02/13 不要フォームの削除
            'If DialogType = SelectType.FTT Then
            '    .StartPosition = FormStartPosition.Manual
            '    .Left = 112 + frmStartCompleteFTT.Left
            '    .Top = Int((frmStartCompleteFTT.Height - .Height) / 2) + frmStartCompleteFTT.Top
            'Else
            ' << del 安部 2018/02/13 不要フォームの削除
            .StartPosition = FormStartPosition.CenterParent
            ' >> del 安部 2018/02/13 不要フォームの削除
            'End If
            ' << del 安部 2018/02/13 不要フォームの削除

            Return .ShowDialog
        End With
    End Function
End Module
